package org.misalen.web.support;

import org.misalen.web.support.jobs.TestJob;
import org.quartz.CronScheduleBuilder;
import org.quartz.JobBuilder;
import org.quartz.JobDetail;
import org.quartz.Scheduler;
import org.quartz.SchedulerException;
import org.quartz.Trigger;
import org.quartz.TriggerBuilder;
import org.quartz.impl.StdSchedulerFactory;

public class MainQuartz {

	public static void start() throws SchedulerException {
		Scheduler scheduler = new StdSchedulerFactory().getScheduler();
		scheduler.start();

		/******** 测试Job ********/
		JobDetail clientHomePageJob = JobBuilder.newJob().ofType(TestJob.class).withIdentity("job1", "group1").build();
		Trigger clientHomePagetrigger = TriggerBuilder.newTrigger().withIdentity("trigger1", "group1")
				// 每天 凌晨0点刷新
				.withSchedule(CronScheduleBuilder.cronSchedule("00 00 00 * * ?")).build();
		scheduler.scheduleJob(clientHomePageJob, clientHomePagetrigger);

	}

}
